package com.tk.demo.mapper;


import com.tk.demo.model.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    @Select("SELECT * FROM user WHERE id = #{id}")
    User getUserById(Integer id);

    @Select("SELECT * FROM user")
    public List<User> getUserList();

    @Insert("insert into user(username, password, phone, age) values(#{username}, #{password}, #{phone},#{age})")
    public int add(User user);

    @Update("UPDATE user SET username = #{User.username}, password = #{User.password}, phone = #{User.phone}, age = #{User.age} WHERE id = #{id}")
    public int update(@Param("id") Integer id, @Param("User") User user);

    @Delete("DELETE from user where id = #{id} ")
    public int delete(Integer id);
}
